package com.deyuanyun.pic.ctrl.controller.dto;

import java.util.Date;

import com.deyuanyun.pic.common.util.StringUtils;
import com.deyuanyun.pic.common.util.web.Asserts;
import com.deyuanyun.pic.ctrl.enumeration.DefectStateEnum;
import com.deyuanyun.pic.ctrl.enumeration.RepairStateEnum;

/**
 * 维修项目前台提交的查询数据VO。
 *  rept为RepairTask的简写。
 * 
 * @author ChenKui
 * @date 2016-06-20
 *
 */
public class RepairTaskQueryVO {

    private String[] repairTaskIds;//任务编号
    
    private String pipeLineId;//管道编号
    
    //private String pipeSegmentId;//管段编号
    private Long beginMileage;//起始绝对距离
    private Long endMileage;//终止绝对距离
    
    private Date planStartDate1;//建议开工时间
    private Date planStartDate2;//建议开工时间

    //下面这个枚举居然是数字，历史以来数据库就是这样标记的状态。
    private DefectStateEnum dataState;//数据状态：已保存，发布
    private RepairStateEnum repairState;//修复状态枚举
    
    /**
     * 
        state01、待发布
        WAIT_FOR_REPAIR、待维修
        ALREADY_REPAIR、已维修
        
     */
    //private String dataAndRepairState;//请求上来的字段，不到数据库中查询，在set方法中做了事儿。

    public void setDataAndRepairState(String dataAndRepairState) {
        //this.dataAndRepairState = dataAndRepairState;
        if(StringUtils.isEmpty(dataAndRepairState)){
            return;
        }
        try {
            dataState = DefectStateEnum.valueOf(dataAndRepairState);
        } catch (Exception e) {
        }
        try {
            repairState = RepairStateEnum.valueOf(dataAndRepairState);
            dataState = DefectStateEnum.state20;
        } catch (Exception e) {
        }
        Asserts.assertTrue(dataState != null || repairState != null, "无法识别的状态：" + dataAndRepairState);
    }
    
    
    //--------------以下为自动生成的------------------
    


    public String getPipeLineId() {
        return pipeLineId;
    }


    public Long getBeginMileage() {
        return beginMileage;
    }


    public Long getEndMileage() {
        return endMileage;
    }


    public void setBeginMileage(Long beginMileage) {
        this.beginMileage = beginMileage;
    }


    public void setEndMileage(Long endMileage) {
        this.endMileage = endMileage;
    }


    public String[] getRepairTaskIds() {
        return repairTaskIds;
    }


    public void setRepairTaskIds(String[] repairTaskIds) {
        this.repairTaskIds = repairTaskIds;
    }


    public Date getPlanStartDate1() {
        return planStartDate1;
    }

    public Date getPlanStartDate2() {
        return planStartDate2;
    }

    public void setPipeLineId(String pipeLineId) {
        this.pipeLineId = pipeLineId;
    }

    public void setPlanStartDate1(Date planStartDate1) {
        this.planStartDate1 = planStartDate1;
    }


    public void setPlanStartDate2(Date planStartDate2) {
        this.planStartDate2 = planStartDate2;
    }


    public DefectStateEnum getDataState() {
        return dataState;
    }


    public void setDataState(DefectStateEnum dataState) {
        this.dataState = dataState;
    }
    
}
